'use client';
import { useState } from 'react';
import { RankingType, mockRankingModuleList } from '../../constant';
import RankingBox from '../RankingBox';
import type { RankingItem } from '../../types';

const PracticeList: React.FC = () => {
  const [contributionList] = useState<RankingItem[]>(
    mockRankingModuleList[0].rankingList
  );
  const [loading] = useState(false); // 静态数据不需要loading

  // 注释掉的API请求
  /*
  const getPracticeRankList = async () => {
    try {
      const res = await req({...});
      setContributionList(res?.data || []);
    } catch (err) {
      console.error(err);
    }
  };
  */

  const onChangeJump = () => {
    window.open('/practise-questions', '_blank');
  };

  return (
    <RankingBox
      isLoading={loading}
      contributionList={contributionList}
      rankingType={RankingType.practice}
      onHandleJump={onChangeJump}
    />
  );
};

export default PracticeList;